home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Languages / MS Cobol4.5 / DEMO / SRTDEM.BAT < prev    next >
DOS Batch File  |  1991-04-08  |  15KB  |  248 lines

  1. echo off
  2. rem    Batch File to Compile, Link, Bind and Run the SORTDEMO demonstration
  3. rem    program. This batch file can be run from your DOS prompt.
  4. rem                                                                 v 1.2.3
  5. cls
  6. echo .
  7. echo     *------------------* SORTDEMO Demonstration Program *-----------------*
  8. echo     *                                                                     *
  9. echo     * This batch stream demonstrates how a program can be "bound" to      *
  10. echo     * enable it to run on DOS and OS/2.                                   *
  11. echo     *                                                                     *
  12. echo     * Bound programs are linked as OS/2 programs prior to binding.        *
  13. echo     * Therefore, in order for this batch stream to operate it is          *
  14. echo     * necessary to have the OS/2 version of the compiler available as     *
  15. echo     * well as the DOS version. This will ensure that the files needed for *
  16. echo     * linking an OS/2 program, and for binding, are all loaded.           *
  17. echo     *                                                                     *
  18. echo     * Please ensure that you have followed the installation instructions  *
  19. echo     * for COBOL, using SETUP to load the DOS compiler, the OS/2 compiler  *
  20. echo     * and the Microsoft Utilities, including the OS/2 specific files.     *
  21. echo     *                                                                     *
  22. echo     * Press Ctrl+C to exit if you have NOT properly installed your        *
  23. echo     * COBOL Compiler, or copied the required files.                       *
  24. echo     *                                                                     *
  25. echo     *---------------------------------------------------------------------*
  26. echo .
  27. pause
  28. cls
  29. echo .
  30. echo     *------------------* SORTDEMO demonstration program *-----------------*
  31. echo     *                                                                     *
  32. echo     * SORTDEMO must be "bound" before it will run under DOS, since it     *
  33. echo     * contains calls to OS/2 API functions.                               *
  34. echo     *                                                                     *
  35. echo     * To bind the program, the files API.LIB and OS2.LIB must be copied   *
  36. echo     * into the current directory. They will have been loaded by SETUP     *
  37. echo     * into the directory you selected for the Microsoft Utilities.        *
  38. echo     *                                                                     *
  39. echo     * Also, BIND.EXE must be available in the current directory or in a   *
  40. echo     * directory on the DOS PATH.                                          *
  41. echo     *                                                                     *
  42. echo     * Press Ctrl+C to exit if these files are not present.                *
  43. echo     *                                                                     *
  44. echo     *---------------------------------------------------------------------*
  45. echo .
  46. pause
  47. cls
  48. if %COBDIR%. == . goto errcob
  49. if not exist API.LIB goto errpre
  50. if not exist OS2.LIB goto errpre
  51. if not exist %cobdir%\CBLBIND.NOT goto erros2
  52. if not exist %cobdir%\CBLBIND.LIB goto erros2
  53. if %1. == lcobol. if not exist %cobdir%\LCOBOL.LIB goto erros2
  54. if %1. == LCOBOL. if not exist %cobdir%\LCOBOL.LIB goto erros2
  55. if %1. == . if not exist %cobdir%\COBLIB.LIB goto erros2
  56. if %1. == . if not exist %cobdir%\COBLIB.DLE goto erros2
  57. if not exist SORTDEMO.CBL goto errtic
  58. :cobret
  59. if %1. == animate. goto doanim
  60. if %1. == ANIMATE. goto doanim
  61. cls
  62. echo     *---------------------------------------------------------------------*
  63. echo     *          Compiling the SORTDEMO demonstration program               *
  64. echo     *---------------------------------------------------------------------*
  65. echo on
  66. COBOL SORTDEMO.CBL OPTSPEED NOTRICKLE ;
  67. echo off
  68. if errorlevel 1 goto nocob
  69. echo     *---------------------------------------------------------------------*
  70. echo     *          Compilation of SORTDEMO has completed successfully         *
  71. echo     *---------------------------------------------------------------------*
  72. pause
  73. cls
  74. echo     *---------------------------------------------------------------------*
  75. echo     *                   Linking the SORTDEMO program                      *
  76. echo     *                                                                     *
  77. echo     *  Note that the program is linked to run under OS/2. The binding     *
  78. echo     *  process which follows the link enables it to be run under DOS as   *
  79. echo     *  well as OS/2.                                                      *
  80. echo     *                                                                     *
  81. if %1. == lcobol. goto ltxtl
  82. if %1. == LCOBOL. goto ltxtl
  83. echo     *  The program will be linked to run with the shared run-time,        *
  84. echo     *  COBLIB. The EXE file created requires the file COBLIB.DLE to be    *
  85. echo     *  present in the COBOL system directories in order to operate.       *
  86. echo     *                                                                     *
  87. echo     *  Since the shared run-time handles all memory under DOS, we need    *
  88. echo     *  to free some back to allow the API calls to work. Setting          *
  89. echo     *  environment variable COBPOOL will do this.                         *
  90. echo     *                                                                     *
  91. echo     *  Restart this batch file with the parameter, LCOBOL, to see the     *
  92. echo     *  program statically linked so that it is independent of any other   *
  93. echo     *  files at run-time. (i.e. enter SRTDEM LCOBOL)                      *
  94. goto ltxte
  95. :ltxtl
  96. echo     *  The program will be statically linked. That is, the COBOL run-time *
  97. echo     *  support required for this program is linked into the EXE file      *
  98. echo     *  making it independent of any other files at run-time.              *
  99. :ltxte
  100. echo     *                                                                     *
  101. echo     *---------------------------------------------------------------------*
  102. if %1. == lcobol. goto linkl
  103. if %1. == LCOBOL. goto linkl
  104. :linkc
  105. echo on
  106. LINK SORTDEMO/NOD,,,COBLIB+OS2 ;
  107. SET COBPOOL=10
  108. echo off
  109. goto linke
  110. :linkl
  111. echo on
  112. LINK SORTDEMO/NOD,,,LCOBOL+OS2 ;
  113. echo off
  114. :linke
  115. if errorlevel == 1 goto linkerr
  116. if not exist SORTDEMO.EXE goto linkerr
  117. echo     *---------------------------------------------------------------------*
  118. echo     *            Linking of SORTDEMO has completed successfully           *
  119. echo     *---------------------------------------------------------------------*
  120. pause
  121. cls
  122. echo     *---------------------------------------------------------------------*
  123. echo     *                   Binding the SORTDEMO program                      *
  124. echo     *---------------------------------------------------------------------*
  125. echo on
  126. BIND SORTDEMO %cobdir%\CBLBIND.LIB OS2.LIB -N @%cobdir%\CBLBIND.NOT
  127. echo off
  128. if errorlevel == 1 goto binderr
  129. echo     *---------------------------------------------------------------------*
  130. echo     *            Binding of SORTDEMO has completed successfully           *
  131. echo     *---------------------------------------------------------------------*
  132. pause
  133. cls
  134. echo     *---------------------------------------------------------------------*
  135. echo     *                         Running SORTDEMO                            *
  136. echo     *---------------------------------------------------------------------*
  137. echo on
  138. SORTDEMO
  139. echo off
  140. if errorlevel == 1 goto runerr
  141. goto endsort
  142. :nocob
  143. echo     ***********************************************************************
  144. echo     *                          *** ERROR ***                              *
  145. echo     *                                                                     *
  146. echo     *  An error occured while compiling SORTDEMO. Please ensure that you  *
  147. echo     *  have installed all the necessary files.                            *
  148. echo     *                                                                     *
  149. echo     ***********************************************************************
  150. goto endsort
  151. :linkerr
  152. echo     ***********************************************************************
  153. echo     *                          *** ERROR ***                              *
  154. echo     *                                                                     *
  155. echo     * An error occured while linking. Please ensure that you have         *
  156. echo     * installed all the necessary files.                                  *
  157. echo     *                                                                     *
  158. echo     ***********************************************************************
  159. goto endsort
  160. :binderr
  161. echo     ***********************************************************************
  162. echo     *                          *** ERROR ***                              *
  163. echo     *                                                                     *
  164. echo     * An error occured during the Bind process. Please ensure that you    *
  165. echo     * have installed all the necessary files and that these files are in  *
  166. echo     * the current working directory or accessible via the DOS PATH, as    *
  167. echo     * appropriate.                                                        *
  168. echo     *                                                                     *
  169. echo     ***********************************************************************
  170. goto endsort
  171. :runerr
  172. echo     ***********************************************************************
  173. echo     *                          *** ERROR ***                              *
  174. echo     *                                                                     *
  175. echo     *    An error occured while running. Please ensure that you have      *
  176. echo     *    correctly installed the COBOL system.                            *
  177. echo     *                                                                     *
  178. echo     ***********************************************************************
  179. goto endsort
  180. :doanim
  181. echo     ***********************************************************************
  182. echo     *                          *** ERROR ***                              *
  183. echo     *                                                                     *
  184. echo     * The SORTDEMO program cannot be Animated on DOS.                     *
  185. echo     *                                                                     *
  186. echo     ***********************************************************************
  187. goto endsort
  188. :errpre
  189. echo     ***********************************************************************
  190. echo     *                          *** ERROR ***                              *
  191. echo     *                                                                     *
  192. echo     * One or both of the files API.LIB and OS2.LIB are not in the         *
  193. echo     * current directory. The bind process will not work correctly without *
  194. echo     * these files. Please copy them into the current directory before     *
  195. echo     * restarting SRTDEM.                                                  *
  196. echo     *                                                                     *
  197. echo     ***********************************************************************
  198. if not exist %cobdir%\CBLBIND.NOT goto erros2
  199. if not exist %cobdir%\CBLBIND.LIB goto erros2
  200. if %1. == LCOBOL. if not exist %cobdir%\LCOBOL.LIB goto erros2
  201. if %1. == lcobol. if not exist %cobdir%\LCOBOL.LIB goto erros2
  202. if %1. == . if not exist %cobdir%\COBLIB.LIB goto erros2
  203. if %1. == . if not exist %cobdir%\COBLIB.DLE goto erros2
  204. if not exist SORTDEMO.CBL goto errtic
  205. goto endsort
  206. :erros2
  207. echo     ***********************************************************************
  208. echo     *                          *** ERROR ***                              *
  209. echo     *                                                                     *
  210. if %1. == LCOBOL. goto los2l
  211. if %1. == lcobol. goto los2l
  212. echo     * Some or all of the files CBLBIND.LIB, CBLBIND.NOT, COBLIB.LIB and   *
  213. echo     * COBLIB.DLL which are loaded by SETUP with the OS/2 compiler, are    *
  214. goto los2e
  215. :los2l
  216. echo     * Some or all of the files CBLBIND.LIB, CBLBIND.NOT, and              *
  217. echo     * LCOBOL.LIB which are loaded by SETUP with the OS/2 compiler, are    *
  218. :los2e
  219. echo     * not in the COBOL system directory (identified by the environment    *
  220. echo     * variable, COBDIR). The link and bind processes in this batch stream *
  221. echo     * will not work correctly without these files. Please load them into  *
  222. echo     * the COBOL system directory before restarting SRTDEM.                *
  223. echo     *                                                                     *
  224. echo     ***********************************************************************
  225. if not exist SORTDEMO.CBL goto errtic
  226. goto endsort
  227. :errcob
  228. echo     ***********************************************************************
  229. echo     *                          *** ERROR ***                              *
  230. echo     *                                                                     *
  231. echo     * The COBDIR environment variable is not set. Please ensure that you  *
  232. echo     * have installed the COBOL system correctly.                          *
  233. echo     *                                                                     *
  234. echo     ***********************************************************************
  235. goto endsort
  236. :errtic
  237. echo     ***********************************************************************
  238. echo     *                          *** ERROR ***                              *
  239. echo     *                                                                     *
  240. echo     * The SORTDEMO program is not in the current directory. Either change *
  241. echo     * directory or copy SORTDEMO.CBL from your issue disks.               *
  242. echo     *                                                                     *
  243. echo     ***********************************************************************
  244. :endsort
  245. echo     *---------------------------------------------------------------------*
  246. echo     *                   End of SORTDEMO Demonstration                     *
  247. echo     *---------------------------------------------------------------------*
  248.